/**
 * @Date: 2022-05-22 09:30:35
 * @LastEditors: sailornpg
 * @LastEditTime: 2022-05-22 17:11:55
 * @FilePath: \my-react-components\.storybook\main.js
 * @Description: something
 */
const path = require("path");
module.exports = {
  stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
  addons: [
    "@storybook/addon-actions",
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-interactions",
    "@storybook/preset-scss",
    "@storybook/addon-info",
  ],
  framework: "@storybook/react",
  core: {
    builde: "@storybook/builder-vite",
  },
  viteFinal: async (config, { configType: env }) => {
    // customize the Vite config here
    const customConfig = {
      resolve: {
        alias: {
          "@": path.resolve("src"),
          "@assets": path.resolve("src/assets"),
        },
      },
      esbuild: {
        jsxInject: `import React from 'react'`,
      },
      css: {
        preprocessorOptions: {
          scss: {
            javascriptEnabled: true,
            additionalData: '@import "@/assets/css/index.scss";',
            include: path.resolve(__dirname, "../"),
          },
        },
      },
    };
    config.plugins.push({
      // test: /\.scss$/,
      // use: ["style-loader", "css-loader", "sass-loader"],
    });
    return { ...config, ...customConfig };
  },
};
